<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="CSI.Directory.Web.Util"%>
<%@ Import Namespace="CSI.Directory.Core.Model"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div class="main_center_content">

<div class="left_content">
    <div class="box" style="width:150px">
    <h2>Sub Categories</h2>
    <% foreach (var sub in (IList<Category>)ViewData["SubCategories"]) {%>
        
       <a href="/Directory/GetCategory/<%=sub.Id %>"><%=sub.Name %></a><br />
            
    <%} %>
    </div>
    <br />
<% Html.RenderPartial("/Views/Shared/LeftMenu.ascx"); %>     
  <script type='text/javascript'><!--      //<![CDATA[
      var m3_u = (location.protocol == 'https:' ? 'https://www.eaglefordflyer.com/advertise/www/delivery/ajs.php' : 'http://www.eaglefordflyer.com/advertise/www/delivery/ajs.php');
      var m3_r = Math.floor(Math.random() * 99999999999);
      if (!document.MAX_used) document.MAX_used = ',';
      document.write("<scr" + "ipt type='text/javascript' src='" + m3_u);
      document.write("?zoneid=5");
      document.write('&amp;cb=' + m3_r);
      if (document.MAX_used != ',') document.write("&amp;exclude=" + document.MAX_used);
      document.write(document.charset ? '&amp;charset=' + document.charset : (document.characterSet ? '&amp;charset=' + document.characterSet : ''));
      document.write("&amp;loc=" + escape(window.location));
      if (document.referrer) document.write("&amp;referer=" + escape(document.referrer));
      if (document.context) document.write("&context=" + escape(document.context));
      if (document.mmm_fo) document.write("&amp;mmm_fo=1");
      document.write("'><\/scr" + "ipt>");
//]]>--></script><noscript><a href='http://www.eaglefordflyer.com/advertise/www/delivery/ck.php?n=a7029c74&amp;cb=7' target='_blank'><img src='http://www.eaglefordflyer.com/advertise/www/delivery/avw.php?zoneid=5&amp;cb=7&amp;n=a7029c74' border='0' alt='' /></a></noscript>
            
</div><!--end of left content-->
<div class="right_content">
    <h1>Search for "<%=((Category)ViewData["Category"]).Name%>" category returned <%=((IList<Listing>)ViewData["Listings"]).Count%> results</h1>
       
    <br />
    <%
        foreach (var l in ((IList<Listing>)ViewData["Listings"]))
        {%>
          <div class="listings">
              <table>
                  <tr>
                      <td colspan="2">
                        <h2><a href="/Directory/Listing/<%=l.Id %>/<%= Url.ToFriendlyUrl(l.Name)%>"><%=l.Name %></a></h2>
                        
                        <div style="font-size:10px;color:#666">
                        <img src="/Assets/Images/clock.png" style="vertical-align:middle" />
                        <%=l.CreateDate.ToLongDateString() %></div>
                      </td>
                  </tr>
                  <tr valign="top">
                    <td>
                        <div style="border:solid 5px white; width:100px;height:100px;overflow:hidden;">
                       
                            <img src="/Assets/Images/<%= (string.IsNullOrEmpty(l.Image)) ? "default.png" : l.Image %>" />
                       
                       </div>
                    </td>
                    <td>
                    <%if (!string.IsNullOrEmpty(l.Description))
                       { %>
                       <div >
                        <p style="padding-top:5px;clear:both;white-space: normal;word-wrap:break-word;"> 
                            <%= (l.Description.Length > 200) ? l.Description.Substring(0, 200) + "..." : l.Description %>
                        </p>
                       </div>
                     
                    <%} %>
                    </td>
                    
                  </tr>
                  <tr><td></td><td align="right"><a href="/Directory/Listing/<%=l.Id %>/<%= Url.ToFriendlyUrl(l.Name) %>"> See full listing</td></tr>
              </table>
             
             
               
                    
             
            
             
             
             
          </div>
          
          <br /> 
          <br />
          
          
        <%} %>
        <span style="right:30px;z-index: 5;">
        <%if ((int)ViewData["Pages"] > 1)
          {
              for (int i = 1; i <= (int)ViewData["Pages"]; i++)
              {
                  if (i == (int)ViewData["Page"])
                  {%>
                    <%=i%>&nbsp;
                  <%}
                  else
                  { %>
              
               
                    <a href="<%=((Category)ViewData["Category"]).Name %>?page=<%=i %>"><%=i%>&nbsp;</a> 
                <%} %>
            <%}
          } %>
          </span>
</div>
<div class="clear"></div>
</div>
</asp:Content>
